(function (G) {
  G.vue(G.classifyList({
    modelName:'menu',
    nickName:'菜单'
  },{
    methods:{
      getList: function () {
        var _this = this,userInfo = G.Storage.get('userInfo');
        Y.ajax('/api/model/menu', function (ret) {
          if (!ret.errorMsg) {
            var tree = {
              '0': {
                children: []
              }
            };
            for (var i = 0; i < ret.length; i++) {
              ret[i].parentId = ret[i].parentId || '0';
              ret[i].opened = true;
              ret[i].children = [];
              tree[ret[i].id] = ret[i];
              if (tree[ret[i].parentId]) {
                tree[ret[i].parentId].children.push(ret[i])
                tree[ret[i].parentId].opened = false;
              }
            }
            _this.setData({
              tree: tree['0'].children
            })
          }
        },{
          data:{
            sql:'classifySort',
            unitId:userInfo.unitId
          }
        })
      }
    }
  }))
})(wx.$)